package forum;

import java.io.Serializable;

public class ForumItem implements Serializable {
	private static final long serialVersionUID = -2635268986242070015L;
	private int itemId;
	private String itemName;
	private ForumTopic topic;
	private boolean printed;

	ForumItem(int itemId, String itemName) {
		this.itemId = itemId;
		this.itemName = itemName;
	}

	public int getItemId() {
		return itemId;
	}

	public void setItemId(int itemId) {
		this.itemId = itemId;
	}

	public String getItemName() {
		return itemName;
	}

	public void setItemName(String itemName) {
		this.itemName = itemName;
	}

	public ForumTopic getTopic() {
		return topic;
	}

	public void setTopic(ForumTopic topic) {
		this.topic = topic;
	}

	public String toString() {
		return itemName + "/" + topic.getTopicName() + " " + itemId + "/"
				+ topic.getTopicId() + " " + printed + "/" + topic.isPrinted();
	}

	public boolean isPrinted() {
		return printed;
	}

	public void setPrinted(boolean printed) {
		this.printed = printed;
	}

	@Override
	public boolean equals(Object o) {
		ForumItem fi = (ForumItem) o;
		return topic.getTopicId() == fi.getTopic().getTopicId()
				&& itemId == fi.itemId;
	}
}
